<?php
if(isset($form['#farmer'])&& !empty($form['#farmer'])) {
    echo get_template_header_info($form['#farmer']);
}
?>
<div class="hp-tab-newprd">
    <?php if(!empty($_GET['farmer_id'])){?>
        <img style="margin-left: 75px;" src="<?php echo base_path()?>sites/all/themes/tweme/images/images/farmer.png"/>
    <?php }else if(!empty($_GET['addr_id'])){ ?>
        <img style="margin-left: 75px;" src="<?php echo base_path()?>sites/all/themes/tweme/images/images/village.png"/>
    <?php }?>
    <ul class="j-sw-nav">
        <?php if(isset($form['#farmer'])&& !empty($form['#farmer'])){?>
            <?php echo get_tab($form['#farmer'],'overview'); ?>
        <?php }?>
    </ul>
    <div class="newprd-s1">
        <div class="table-div">
            <div class="fieldset-div">
                <div class="fieldset-title">农户信息</div>
                <?php //foreach($form['farmer_info']['#markup']['plant_info'] as $key => $val){
                        $famer_info = $form['farmer_info']['#markup']['farmer_info'];
                ?>
                    <div class="farmer-field">
                        <div class="farmer-field-div">
                            <span>经销商:</span>
                            <span><?php echo $famer_info->distributor_name;?></span>
                        </div>
                        <div class="farmer-field-div">
                            <span>地址:</span>
                            <span><?php echo $famer_info->addr_name;?></span>
                        </div>
                        <div class="farmer-field-div">
                            <span>详细地址:</span>
                            <span><?php echo $famer_info->addr_details;?></span>
                        </div>
                    </div>

                <div class="farmer-field">
                    <div class="farmer-field-div second">
                        <span>姓名:</span>
                        <span><?php echo $famer_info->farmer_name;?></span>
                    </div>
                    <div class="farmer-field-div second">
                        <span>性别:</span>
                        <span><?php echo $famer_info->gender;?></span>
                    </div>
                    <div class="farmer-field-div second">
                        <span>手机:</span>
                        <span><?php echo $famer_info->cell;?></span>
                    </div>
                    <div class="farmer-field-div second">
                        <span>电话:</span>
                        <span><?php echo $famer_info->phone;?></span>
                    </div>
                    <div class="farmer-field-div second">
                        <span>邮箱:</span>
                        <span><?php echo $famer_info->email;?></span>
                    </div>
                </div>
                <div class="farmer-field">
                    <div class="farmer-field-div second">
                        <span>农户类型:</span>
                        <span><?php echo $famer_info->type;?></span>
                    </div>
                    <div class="farmer-field-div second">
                        <span>耕地面积:</span>
                        <span><?php echo $famer_info->farm_area;?></span>
                    </div>
                    <div class="farmer-field-div second">
                        <span>土壤种类:</span>
                        <span><?php echo $famer_info->soil_type;?></span>
                    </div>
                    <div class="farmer-field-div second">
                        <span>肥沃程度:</span>
                        <span><?php echo $famer_info->soil_fertility;?></span>
                    </div>
                </div>
                <div style="clear: both;"></div>
            </div>

            <?php if(user_access('view own plant_info')){ ?>
            <div class="fieldset-div plant-info-div <?php echo count($form['farmer_info']['#markup']['plant_info']);?> farmer-overview-item-div">
                <div class="fieldset-title">种植信息<div style="float: right"><span class="farmer-datacount 4">4条</span><span class="farmer-datacount 8">8条</span><span class="farmer-datacount 12">12条</span><span class="farmer-datacount 16">16条</span><span class="farmer-datacount 20">20条</span></div></div>
                <?php foreach($form['farmer_info']['#markup']['plant_info'] as $key => $val){ ?>
                    <div class="fieldset-content">
                        <table class="fieldset-table">
                            <tbody>
                                <tr>
                                    <td class="fieldset-tr-title">作物:</td>
                                    <td><?php echo $val->plant_name;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">播种日期:</td>
                                    <td><?php echo $val->sow_date;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">收获日期:</td>
                                    <td><?php echo $val->harvest_date;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">种植面积:</td>
                                    <td><?php echo $val->plant_area;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">种子种类:</td>
                                    <td><?php echo $val->seed;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">株距(厘米):</td>
                                    <td><?php echo $val->plant_space;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">行距(厘米):</td>
                                    <td><?php echo $val->row_space;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">灌溉方式:</td>
                                    <td><?php echo $val->irrigation;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">撒可富赠肥量:</td>
                                    <td><?php echo $val->sacf_fertilizer;?></td>
                                </tr>
                            </tbody>
                        </table>

                        <table class="fieldset-table">
                            <tbody>
                                <tr>
                                    <td class="fieldset-tr-title">种子开销:</td>
                                    <td><?php echo $val->seed_cost;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">肥料开销:</td>
                                    <td><?php echo $val->fertilizer_cost;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">农药开销:</td>
                                    <td><?php echo $val->pesticide_cost;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">农机开销:</td>
                                    <td><?php echo $val->machinery_cost;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">其他开销:</td>
                                    <td><?php echo $val->others_cost;?></td>
                                </tr>
                                <tr>
                                    <td class="fieldset-tr-title">一般产量:</td>
                                    <td><?php echo $val->general_yield;?></td>
                                </tr>
                                <tr>
                                    <td  class="fieldset-tr-title">其他收益:</td>
                                    <td><?php echo $val->other_yield;?></td>
                                </tr>
                                <tr>
                                    <td  class="fieldset-tr-title">示范面积(亩):</td>
                                    <td><?php echo $val->demonstration_area;?></td>
                                </tr>
                                <tr>
                                    <td  class="fieldset-tr-title">撒可富品种:</td>
                                    <td><?php echo $val->sacf;?></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                <?php }?>
                <div style="clear: both;"></div>
            </div>
            <?php }?>
            <?php if(user_access('view own soil_info')){ ?>
            <div class="fieldset-div soil-info-div <?php echo count($form['farmer_info']['#markup']['soil_info']);?>  farmer-overview-item-div">
                <div class="fieldset-title">土壤信息<div style="float: right"><span class="farmer-datacount 4">4条</span><span class="farmer-datacount 8">8条</span><span class="farmer-datacount 12">12条</span><span class="farmer-datacount 16">16条</span><span class="farmer-datacount 20">20条</span></div></div>
                <?php foreach($form['farmer_info']['#markup']['soil_info'] as $key => $val){ ?>
                    <div class="fieldset-content soil-field">
                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">实验标题:</td>
                                <td><?php echo $val->title;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">实验地点:</td>
                                <td><?php echo $val->location;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">送样人:</td>
                                <td><?php echo $val->sampler;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">采样日期:</td>
                                <td><?php echo $val->sample_date;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">目标产量:</td>
                                <td><?php echo $val->target_yield;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">前茬作物:</td>
                                <td><?php echo $val->pre_plant_id;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">推荐作物:</td>
                                <td><?php echo $val->rec_plant_id;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">氮(mg/L):</td>
                                <td><?php echo $val->nitrogen;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">磷(mg/L):</td>
                                <td><?php echo $val->phosphorus;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">钾(mg/L):</td>
                                <td><?php echo $val->potassium;?></td>
                            </tr>

                            </tbody>
                        </table>

                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">有机质(mg/L):</td>
                                <td><?php echo $val->organicmatter;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">ph值:</td>
                                <td><?php echo $val->ph;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">钙(mg/L):</td>
                                <td><?php echo $val->calcium;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">镁(mg/L):</td>
                                <td><?php echo $val->magnesium;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">硫(mg/L):</td>
                                <td><?php echo $val->sulfur;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">锌(mg/L):</td>
                                <td><?php echo $val->zinc;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">铜(mg/L):</td>
                                <td><?php echo $val->copper;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">铁(mg/L):</td>
                                <td><?php echo $val->iron;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">硼(mg/L):</td>
                                <td><?php echo $val->boron;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">锰(mg/L):</td>
                                <td><?php echo $val->manganese;?></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                <?php }?>
                <div style="clear: both;"></div>
            </div>
            <?php }?>
            <?php if(user_access('view gift')){ ?>
            <div class="fieldset-div gift-info-div <?php echo count($form['farmer_info']['#markup']['gift_info']);?> farmer-overview-item-div">
                <div class="fieldset-title">我的礼物<div style="float: right"><span class="farmer-datacount 4">4条</span><span class="farmer-datacount 8">8条</span><span class="farmer-datacount 12">12条</span><span class="farmer-datacount 16">16条</span><span class="farmer-datacount 20">20条</span></div></div>
                <?php foreach($form['farmer_info']['#markup']['gift_info'] as $key => $val){ ?>
                    <div class="fieldset-content gift-field">
                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">礼物类型:</td>
                                <td><?php echo $val->gift_type;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">赠送数量:</td>
                                <td><?php echo $val->quantity;?></td>
                            </tr>
                            </tbody>
                        </table>

                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">备注:</td>
                                <td><?php echo $val->comments;?></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                <?php }?>
                <div style="clear: both;"></div>
            </div>
            <?php }?>
            <?php if(user_access('view own fertilizer_case')){ ?>
            <div class="fieldset-div fertilizer-info-div <?php echo count($form['farmer_info']['#markup']['fertilizer_caseinfo']);?>  farmer-overview-item-div">
                <div class="fieldset-title">施肥案例<div style="float: right"><span class="farmer-datacount 4">4条</span><span class="farmer-datacount 8">8条</span><span class="farmer-datacount 12">12条</span><span class="farmer-datacount 16">16条</span><span class="farmer-datacount 20">20条</span></div></div>
                <?php foreach($form['farmer_info']['#markup']['fertilizer_caseinfo'] as $key => $val){ ?>
                    <div class="fieldset-content fertilizer-field">
                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">实际产量:</td>
                                <td><?php echo $val->real_yield;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">作物:</td>
                                <td><?php echo $val->plant_name;?></td>
                            </tr>
                            </tbody>
                        </table>

<!--                        <table class="fieldset-table">-->
<!--                            <tbody>-->
<!---->
<!--                            <tr>-->
                        <div style="clear:both; height: 20px; overflow: hidden" class="fieldset-tr-title">
<!--                                <td class="fieldset-tr-title">-->
<!--                                    效果描述:-->
<!--<!--                                </td><td>-->
<!--                                --><?php //echo $val->effect_desc;?>
<!--                            </td>-->
<!--                            </tr>-->
<!--                            </tbody>-->
<!--                        </table>-->
                            </div>
                    </div>
                <?php }?>
                <div style="clear: both;"></div>
            </div>
            <?php }?>
            <?php if(user_access('view own revisit')){ ?>
            <div class="fieldset-div revisit-info-div <?php echo count($form['farmer_info']['#markup']['revisit_info']);?> farmer-overview-item-div">
                <div class="fieldset-title">回访记录<div style="float: right"><span class="farmer-datacount 4">4条</span><span class="farmer-datacount 8">8条</span><span class="farmer-datacount 12">12条</span><span class="farmer-datacount 16">16条</span><span class="farmer-datacount 20">20条</span></div></div>
                <?php foreach($form['farmer_info']['#markup']['revisit_info'] as $key => $val){ ?>
                    <div class="fieldset-content revisit-field">
                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">回访日期:</td>
                                <td><?php echo $val->visit_date;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">单产量:</td>
                                <td><?php echo $val->unit_yield;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">纯收益:</td>
                                <td><?php echo $val->net_income;?></td>
                            </tr>
                            </tbody>
                        </table>

                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">作物:</td>
                                <td><?php echo $val->plant_name;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">对照产量:</td>
                                <td><?php echo $val->contrast_yield;?></td>
                            </tr>
                            <tr>
                                <td class="fieldset-tr-title">对照收益:</td>
                                <td><?php echo $val->contrast_income;?></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                <?php }?>
                <div style="clear: both;"></div>
            </div>
            <?php }?>
            <?php if(user_access('view own plant_measure')){ ?>
            <div class="fieldset-div measure-info-div <?php echo count($form['farmer_info']['#markup']['plant_measure_info']);?>  farmer-overview-item-div">
                <div class="fieldset-title">田间测产<div style="float: right"><span class="farmer-datacount 4">4条</span><span class="farmer-datacount 8">8条</span><span class="farmer-datacount 12">12条</span><span class="farmer-datacount 16">16条</span><span class="farmer-datacount 20">20条</span></div></div>
                <?php foreach($form['farmer_info']['#markup']['plant_measure_info'] as $key => $val){ ?>
                    <div class="fieldset-content measure-field">
                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">测产日期:</td>
                                <td><?php echo $val->date;?></td>
                            </tr>
                            </tbody>
                        </table>

                        <table class="fieldset-table">
                            <tbody>
                            <tr>
                                <td class="fieldset-tr-title">农作物:</td>
                                <td><?php echo $val->plant_name;?></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                <?php }?>
                <div style="clear: both;"></div>
            </div>
            <?php }?>
            <div style="clear: both;"></div>
     </div>
    </div>
</div>
<div style="display: none"><?php print render($form['farmer_info']); ?></div>
<?php print drupal_render_children($form); ?>
